package com.adou.d9.udp1;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Client {
    public static void main(String[] args) throws Exception {
        // 1.创建客户端对象
        DatagramSocket socket = new DatagramSocket();

        // 2.创建数据包对象封装发出去数据
        byte[] bytes = "我是快乐的客户端！！！".getBytes();
        DatagramPacket packet = new DatagramPacket(bytes, bytes.length, InetAddress.getLocalHost(), 6666);

        // 3.发送数据
        socket.send(packet);


        System.out.println("客户端数据发放完毕...");
        // 4.释放资源
        socket.close();
    }
}
